package com.whpost.service.dao.stamp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.whpost.service.entity.stamp.StampHdMb;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YinZhuoyi
 * @since 2024-04-11
 */
public interface StampHdMbMapper extends BaseMapper<StampHdMb> {


    @Select("select a.*,b.hd_id from (select * from stamp_hd_mb where ${ew.sqlSegment}) a left join (select * from stamp_hd_mb_dyb where hd_id=#{hd_id}) b on b.mb_id = a.id")
    @Results(id="stampHdMb_DYB")
    IPage<StampHdMb> getMbDybIPage(Page<StampHdMb> page, @Param("ew") QueryWrapper wrapper,@Param("hd_id") String hd_id);

    @Select("select * from stamp_hd_mb where id in (select mb_id from stamp_hd_mb_dyb where hd_id=#{hd_id} and lx=#{lx} and state='1')")
    List<StampHdMb> getMbList(@Param("hd_id") String hd_id,@Param("lx") String lx);

}
